home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / gfx / misc / gnuplot-src.lha / gnuplot-3.7.1src / gnuplot-3.7.1.lha / gnuplot-3.7.1 / docs / old / README.3d < prev    next >
Encoding:
Text File  |  1998-11-16  |  6.1 KB  |  108 lines

  1.  
  2.            n that
  3. case (seeal on explicit/parametric
  4.                                    and
  5.                     everything you did not dare to ask
  6.                                   about
  7.                            curves and surfaces
  8.                                     in
  9.                                   gnuplot
  10.  
  11. Several types of curves and surface are supported in gnuplot. Of those
  12. not every operation is supported for every curve or surface type and it
  13. can be therefore useful to understand the different types, their advantages
  14. and limitations.
  15.  
  16. Curves in gnuplot are almost always planar (with one exception which we
  17. will deal with in the end) and are assumed to be in the XY plane.
  18. Therefore only X and Y coordinates are needed for plotting curves.
  19. The simplest curve is the `explicit function`. This curve is in fact a
  20. function and for each given x, there is one and only one y value associated
  21. with it. A gnuplot example for such type is `plot sin(x)` or
  22. `plot "datafile" using 1". Note the later is using only a single column from
  23. the data file which is assumed to be the y values.
  24.  
  25. Alternatively one can define a `parametric curve` form. In this case
  26. x and y are both functions of a third free parameter t, while independent
  27. of each other. A circle can be expressed parametrically as x = cos(t),
  28. y = sin(t) and be plotted using gnuplot as
  29. 'set parametric; plot cos(t),sin(t)'.
  30. This form is not a function since there can be unlimited number of y values
  31. associated with same x. Furthermore the explicit form is a special case of
  32. the parametric representation by letting x equal to t. The curve y = sin(x)
  33. can be written in parametric form as y = sin(t), x = t.
  34.  
  35. We are used to think of the plane in cartesian coordinate system.
  36. In practice, some coordinate systems may be easier to use then others
  37. under some circumstances. The polar form uses a different basis
  38. to span the XY plane. In this representation the cartesian x coordinate
  39. is equal to r cos(t) and the cartesian y coordinate is equal to r sin(t).
  40. To draw a unit circle using the polar coordinate system in gnuplot use the
  41. following simple command: 'set polar; plot 1'. To better understand this
  42. explicit form lets backup a little.
  43. When we plot a regular explicit function like `y = sin(x)` we march in equal
  44. steps in x, evaluate the provided function and plot a piecewise linear curve
  45. between the sampled points approximating the real function. In the polar
  46. explicit form we do exactly the same thing, but we march along the angular
  47. direction - we turn around the origin, computing the length of the radius
  48. at that angle. Since for the unit circle, this radius is a constant 1,
  49. `plot 1` in polar form plots a circle (if t domain is from 0 or 2Pi).
  50. Note the polar form is explicit in that for each angle there is only a
  51. single radius.
  52.  
  53. Surprisingly (or maybe not so surprising) surfaces share the same
  54. representations. Since surfaces are two dimensional entities, they
  55. require two free parameters (like t for curves).
  56.  
  57. A surface explicit function uses x and y as the free parameters. For
  58. each such pair it provides a single z value. An example for this form
  59. can be `splot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)` for a three dimensional
  60. sinc function or `splot 'datafile' using 1`. As for curves, the single column
  61. used from the data file defines the function value or z in this case.
  62. The order of the x and y function values is very strict in this form and
  63. simply defines a rectangular grid in the XY plane. Fortunately this
  64. strict form allows us to apply a very simplistic hidden line algorithm
  65. called "the floating horizon". This hidden line algorithm exploits the
  66. rectangular XY domain of the surface and therefore may be used for this
  67. type of surfaces only. Since in gnuplot this is the only form of hidden
  68. lines removing algorithm provided, only explicit surfaces may have their
  69. hidden lines removed.
  70.  
  71. Parametric surfaces are the exact extension for explicit surfaces as in
  72. the curves case. the x, y, and z are defined in terms of two new free
  73. variables and are totally independent of each other as x(u, v), y(u, v),
  74. and z(u, v). Again the explicit surface is a special case of the parametric
  75. representation where x = u, and y = v. Examples for plotting parametric
  76. surfaces in gnuplot can be `splot cos(u)*cos(v),cos(u)*sin(v),sin(u)` which
  77. defines a sphere, or `splot "datafile" using 1:2:3`. Since these are
  78. parametric surfaces, gnuplot must be informed to handle them by issuing
  79. `set parametric`.
  80.  
  81. The curve polar form takes the obvious extensions in the surface world.
  82. The first possible extension is spherical coordinate system, while the
  83. second is the cylindrical one. These modes currently work for data files
  84. only and both requires two parameters, theta and phi for mapping onto the
  85. unit sphere, and theta and z form mapping on a unit radius cylinder as follow:
  86.  
  87.         Spherical coord.                        Cylin. coord.
  88.         ----------------                        -------------
  89.         x = cos( theta ) * cos( phi )           x = cos( theta )
  90.         y = sin( theta ) * cos( phi )           y = sin( theta )
  91.         z = sin( phi )                          z = z
  92.  
  93. This subject brings us back to non planar curves. When surfaces are displayed
  94. under gnuplot, isocurves are actually getting plotted. An isocurve is a
  95. curve on the surface in which one of the two free parameters of the
  96. surface is fixed. For example the u isolines of a surface are drawn by
  97. setting u to be fixed and varying v along the entire v domain. The v isolines
  98. are similarly drawn by fixing v. When data files are specified they are
  99. classified internally into two types. A surface is tagged to have grid
  100. topology if all its specified isolines are of the same length. A data mesh
  101. of five isolines, seven points each is an example. In such a case the
  102. surface cross isolines are drawn as well. Seven isolines with five points
  103. each will be automatically created and drawn for grid type data. If
  104. however, isolines of different length are found in the data, it is
  105. tagged as nongrid surface and in fact is nothing more than a collection
  106. of three dimensional curves. Only the provided data is plotted in that
  107. case (see world.dem for such an example).
  108.